package com.user.gateway.filter;


import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * 对所有的请求进行请求拦截
 * @description 
 * @author monxz
 * @date 2020年9月10日
 *
 */

public class AuthFilter implements GlobalFilter, Ordered{

	@Override
	public int getOrder() {
		 //顺序，多个filter的时候使用，越小越先加载
		return 1;
	}

	@Override
	public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {	
		String token = exchange.getRequest().getQueryParams().getFirst("token");
		System.err.println(token);
		return chain.filter(exchange);
	}

	
	
}
